package v2;

/**
 * @Description: 坦克爆炸效果
 * @CreateTime: 2024-01-30  09:51
 * @Author: JAMILA
 * @Version: 1.0
 */

public class Bomb {
    private int x;//炸弹x坐标
    private int y;//炸弹y坐标
    private int life=9;//炸弹生命周期
    private boolean isLive=true;//炸弹存活状态

    public Bomb(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getLife() {
        return life;
    }

    public void setLife(int life) {
        this.life = life;
    }

    public boolean isLive() {
        return isLive;
    }

    public void setLive(boolean live) {
        isLive = live;
    }

    /**
     * 减少生命值，配合出现图片的爆炸效果
     */
    public void lifeDown(){
        if(life > 0) {
            life--;
        } else {
            isLive = false;
        }
    }
}
